<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
 <!-- 增加用户开始 -->
			<div id="dialog-message">
				<form id="register_from">
					<!-- <legend>Form</legend> -->
					<input type="hidden" id="table_id" value="${param.table_id}">
					 <table>
					 	<tr>
					 		<td width="50%">
					 		<fieldset>
								<label>用户名：</label>
								<input type="text" id="userName" value="${param.userName}" require='true' name="userName" meth="notNull,isLength-6" maxlength="30"  title="用户名称不能少于4位，由英文和数字组成" />
								<span class="help-block"></span> 
							</fieldset>
					 		</td>
					 		<td width="50%">
					 		<fieldset>
								<label>中文名：</label>
								<input type="text" id="userShowName" value="${param.userShowName}"  name="userShowName" require='true' meth="notNull,isLength-2" maxlength="30"  title="中文名称不能少于2位" />
								<span class="help-block"></span> 
							</fieldset>
					 		
					 		</td>
					 	</tr>
					 	<tr>
					 		<td>
					 		<fieldset>
								<label>英文名：</label>
								<input type="text" id="userEngListName"  value="${param.userEngListName}"  require='true' name="userEngListName" meth="notNull,isLength-2" maxlength="30"  title="英文名称不能少于两位，则不能为空" />
								<span class="help-block"></span> 
							</fieldset>
					 		</td>
					 		<td>
					 		<fieldset>
								<label>年龄：</label>
								<input type="text" id="age"  value="${param.age}"  require='true' name="age" meth="notNull,isLength-2,isNumber" maxlength="2"  title="年龄只能输入数字，则不能大于100" />
								<span class="help-block"></span> 
							</fieldset>
					 		
					 		</td>
					 	</tr>
					 	<tr>
					 		<td>
					 		<fieldset>
								<label>密码：</label>
								<input type="text" id="userPwd"  value="${param.userPwd}"  require='true' name="userPwd" meth="notNull,isLength-6" maxlength="30"  title="用户密码不能少于6位" />
								<span class="help-block"></span> 
							</fieldset>
					 		</td>
					 		<td>
					 		<fieldset>
								<label>确认密码：</label>
								<input type="text" id="userPwd1"  value="${param.userPwd}"  require='true' name="userPwd1" meth="notNull,isLength-6" maxlength="30"  title="用户密码不能少于6位" />
								<span class="help-block"></span> 
							</fieldset>
					 		
					 		</td>
					 	</tr>
					 	<tr>
					 		<td>
					 							性别：&nbsp;&nbsp;
							 							   <div style="float:right;width:155px;">
									   						<select class="width-155 form-control" id="sex">
																<option value="1">男</option>
																<option value="0">女</option> 
															</select>
															</div>	
					 		</td>
					 		<td>
					 		<fieldset>
								<label>电话：</label>
								<input type="text" id="tell" value="${param.tell}"   require='true' name="tell" meth="notNull,isMobil" maxlength="11"  title="注意电话号码格式例如:13556781230" />
								<span class="help-block"></span> 
							</fieldset>
					 		
					 		</td>
					 	</tr>
					 	<tr>
					 		<td>
					 		<fieldset>
								<label>邮箱：</label>
								<input type="text" id="userEmail"  value="${param.userEmail}" name="userEmail" maxlength="30"  />
								<span class="help-block"></span> 
							</fieldset>
					 		</td>
					 		<td>
					 		<fieldset>
								<label>座右铭：</label>
								<input type="text" id="note"   value="${param.note}" name="note"   />
								<span class="help-block"></span> 
							</fieldset>
					 		
					 		</td>
					 	</tr>
					 	<tr>
					 		<td>
  							类型：&nbsp;&nbsp;
 							   <div style="float:right;width:155px;">
		   						<select class="width-155 form-control" id="userType">
									<option value="4">助教</option>
									<option value="6">管理员</option>  
								</select>
								</div>	
					 		</td>
					 		<td> 	
					 		头像：&nbsp;&nbsp; <div style="float:right;width:155px;"><input name="File1" id="File1" type="file"/> 
					 			</div>
					 		</td> 
					 	</tr>
					 </table>  
				</form>							 
			</div>
			<!-- 增加用户结束-->
<script>
(function(){
	//增加用户
	 function addUser(contrl){
		var a =$("#register_from").hzValidate("init");  
		if(a==false){
			return;
		}else{
			var pd = $("#userPwd").val();
			var pd1 = $("#userPwd1").val();
			if(pd != pd1){
				 $("#userPwd").popover({
					    html: '密码不能为空，,或者长度不能小于6位'
				 });
				 $("#userPwd").popover("open");
				 $("#userPwd1").popover({
					    html: '密码不能为空，,或者长度不能小于6位,或两次密码输入不一致'
				 });
				 $("#userPwd1").popover("open");
				return false;
			} 
			var object = OAajaxSubmit("register_from"); 
			$.ajaxFileUpload
			(
				{
					url: "${pageContext.request.contextPath}/edu/sysUserAction.do?method=addUser&r="+Math.random(),
					secureuri:false,
					fileElementId:["File1"],
					dataType: 'json',
					data:object,
					success: function (data, status)
					{
						if(data.code=="1"){
							alert(data.message);
							
							$(contrl).dialog("destroy" ); 
							$("#user_include").html("");
							window.user.loadUser(null,{});
						
						}else{
							alert(data.message);
						}
						
					},
					error: function (data, status, e)
					{
						alert("上传失败!");
					}
				}
			)
		}
	 };
	 $(function(){ 
		 if("${param.sex}"!=""){
			 for(var i=0;i<$("#sex").find("option").length;i++){
				 if($("#sex").find("option")[i].value=="${param.sex}"){
					 $("#sex").find("option")[i].selected=true;
				 }
			 }
		 }
		 if("${param.userType}"!=""){
			 for(var i=0;i<$("#userType").find("option").length;i++){
				 if($("#userType").find("option")[i].value=="${param.userType}"){
					 $("#userType").find("option")[i].selected=true;
				 }
			 }
		 }
	 });
	 window.userAdd={};
	 window.userAdd.addUser=addUser;
	
})()

</script>